(deftemplate animale
    (slot nume)
    (slot mediuViata)
    (slot modViata)
    (slot regimAlimentar)
    (slot zona)
    (slot consumatorDe)
    (slot consumatDe)
)

(assert (animale (nume broasca)(mediuViata semiacvatic)(modViata diurn)(regimAlimentar omnivor)
    (zona mediteraneana)(consumatorDe lacuste)(consumatDe om)))
(assert (animale (nume foca)(mediuViata acvatic)(modViata diurn)(regimAlimentar omnivor)
    (zona polara)(consumatorDe pesti)(consumatDe urs)))
(assert (animale (nume ursPolar)(mediuViata semiacvatic)(modViata diurn)(regimAlimentar omnivor)
    (zona polara)(consumatorDe foca)(consumatDe -)))
(assert (animale (nume tigru)(mediuViata terestru)(modViata diurn)(regimAlimentar carnivor)
    (zona deserturilor)(consumatorDe capre)(consumatDe -)))
(assert (animale (nume leu)(mediuViata terestru)(modViata diurn)(regimAlimentar carnivor)
    (zona deserturilor)(consumatorDe capre)(consumatDe -)))
(assert (animale (nume hiena)(mediuViata terestru)(modViata nocturn)(regimAlimentar omnivor)
    (zona mediteraneana)(consumatorDe viezure)(consumatDe leu)))
(assert (animale (nume liliac)(mediuViata terestru)(modViata nocturn)(regimAlimentar ierbivor)
    (zona mediteraneana)(consumatorDe lapte)(consumatDe pisica)))
(defrule q2
    (declare (salience 22))
    (animale (nume ?n)(regimAlimentar ierbivor)(zona mediteraneana))
    
    => 
    (printout t "Animalul " ?n " este ierbivor si traieste intr-un zona mediteraneana." crlf)
 )
(defrule q3
    (declare (salience 13))
    (animale (nume ?n)(consumatorDe ?x))
        
    => 
    (printout t "(" ?n ", " ?x ")"crlf)
 )
(defrule q4
    (declare (salience 6))
    (animale (nume ?n)(consumatDe ?x))
        
    => 
    (printout t "(" ?x ", " ?n ")"crlf)
 )
(defrule q1
    (declare (salience 31))
    (animale (nume ?n)(mediuViata semiacvatic))
    
    => 
    (printout t "Animalul " ?n " traieste intr-un mediu semiacvatic." crlf)
 )

(defrule q5
    (declare (salience 5))
    (animale (nume ?n)(zona ?z &~mediteraneana & ~deserturilor)) 
        
    => 
    (printout t "Animalul " ?n " traieste intr-o zona polara" crlf)
 )


(run)

